package com.gtt.pattern.creational.prototype;

/**
 * Dog Clone
 * 
 * @author Michael(gao12581@sina.com)
 * @date 2011-2-25 12:40:44
 * 
 */
public class DogClone implements Cloneable {

    private int legCounts;
    Dog dog = new Dog(4);

    public int getLegCounts() {
        return legCounts;
    }

    @Override
    protected DogClone clone() throws CloneNotSupportedException {
        DogClone dogClone = (DogClone) super.clone();
        dogClone.dog = dog.clone();
        return dogClone;
    }

    public void setLegCounts(int legCounts) {
        this.legCounts = legCounts;
    }

    public Dog getDog() {
        return dog;
    }

    public void setDog(Dog dog) {
        this.dog = dog;
    }

    @Override
    public String toString() {
        return Integer.toString(legCounts);
    }

}
